keepalived 单独配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
! Configuration File for keepalived
global_defs {
notification_email {
lihuiyw@jd.com
}
notification_email_from lihuiyw@jd.com
smtp_server mail.jd.com
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_script check_alive
{
script "/export/sh/check_nginx_alive.sh"
# check every 2 seconds
interval 2
# if failed, decrease 10 of the priority
weight -10
# require 2 failures for failures
fail 2
# require 1 sucesses for ok
rise 1
}
vrrp_instance VIP_${routerid}
{
state $role
interface $interface
virtual_router_id $routerid
priority $weight
advert_int 2
garp_master_delay 10
smtp_alert
authentication
{
auth_type PASS
auth_pass 123456
}
virtual_ipaddress
{
${vip}/24
}
track_interface
{
$interface
}
track_script
{
check_alive
}
}